<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小二菜单后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.5.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.5.3/themes/icon.css">
    <script type="text/javascript" src="/static/jquery-easyui-1.5.3/jquery.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.5.3/locale/easyui-lang-zh_CN.js"></script>

    <script>

        $(document).ready(function () {


            $.get("/v1/apis/getUserInfo", function (result) {

                if (result == null || result.length <= 0) {

                    document.location = '/v1/pages/test/login'
                    return
                }


                if (result["Role"]["Id"] == 1) {
                    addTab()
                }

                $("#name").text(result["UserName"]);

            });

        });

        function addTab() {


            $('#menu').accordion('add', {
                animate: true,
                title: "会员管理",
                //click:GetSmallMenu(n.MenuID,n.MenuName),
//                iconCls: 'icon-menu-' + n.MenuImg.replace(new RegExp('.png'), ''),
                selected: true,
                content: '<div style="padding:10px;" title="会员管理" data-options="fit:true,border:false,iconCls:\'icon-wrench\'">' +
                '<a href="javascript:openTab(\'会员管理\',\'/v1/pages/test/user/manager\',\'icon-user_home\')" class="easyui-linkbutton" data-options="plain:true,iconCls:\'icon-user_home\'">会员管理</a><br/>' +
                '</div>'
            });

//
            <!--<div style="padding:10px;" title="会员管理" data-options="iconCls:'icon-wrench'">-->
//
            <!--<a href="javascript:openTab('会员管理','/pages/user/manager','icon-user_home')" class="easyui-linkbutton"-->
//        <!--data-options="plain:true,iconCls:'icon-user_home'">会员管理</a><br/>-->
//                <!--</div>-->


//            if ($('#tabs').tabs('exists', title)) {
//                $('#tabs').tabs('select', title);
//            } else {
//                var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
//                $('#tabs').tabs('add', {
//                    title: title,
//                    content: content,
//                    closable: true
//                });
//            }
        };

    </script>
    <style>
        .top {
            background: url(/static/img/top.png) repeat-x;
            height: 78px;
            position: relative;
        }

        .top .title {
            font-size: 24px;
            color: #000;
            font-family: \5FAE\8F6F\96C5\9ED1;
            position: absolute;
            left: 20px;
            top: 20px;
        }

        .top .out {
            position: absolute;
            top: 30px;
            right: 20px;
            font-size: 12px;
            color: #000;
        }

        .top .out a {
            color: #000;
            text-decoration: none;
        }

        .panel-body {
            overflow: hidden;
        }

        * {
            margin: 0px;
            padding: 0px;
            list-style: none;
            font-size: 12px;
            font-family: 宋体;
        }

        .line20 {
            clear: both;
            font-size: 0px;
            height: 20px;
            overflow: hidden;
        }

        .nlist-1 {
            line-height: 45px;
            color: #444;
            font-size: 14px
        }

        .nlist-1 ul {
            padding: 0 0 0 20px;
            overflow: hidden;
        }

        .nlist-1 ul:after {
            clear: both;
            content: ".";
            display: block;
            height: 0;
            visibility: hidden
        }

        .nlist-1 ul li {
            float: left;
            margin-right: 10px;
            width: 32%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .nlist-2 {
            line-height: 30px;
            border: 1px solid #ebebeb;
            color: #444;
            font-size: 14px;
        }

        .nlist-2 h3 {
            margin: 0;
            padding: 0 0 0 20px;
            font-size: 12px;
            font-weight: bold;
            color: #333;
            line-height: 34px;
            height: 34px
        }

        .nlist-2 h3 i {
            display: inline-block;
            margin-right: 3px;
            width: 14px;
            height: 16px;
            vertical-align: middle;
            background: url(/static/img/item.png) -56px -112px no-repeat;
            overflow: hidden
        }

        .nlist-2 ul {
            padding: 0 0 10px 20px;
            overflow: hidden;
        }

        .nlist-2 p {
            padding-left: 20px;
        }

        .nlist-2 ul:after {
            clear: both;
            content: ".";
            display: block;
            height: 0;
            visibility: hidden
        }

        .nlist-2 ul li {
            float: left;
            margin-right: 10px;
            width: 32%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis
        }

        a:link {
            text-decoration: none;
        }

        a:visited {
            text-decoration: none;
        }

        a:hover {
            text-decoration: none;
        }

        a:active {
            text-decoration: none;
        }
    </style>
    <script>

        var url;
        function openTab(text, url, iconCls) {
            if ($("#tabs").tabs("exists", text)) {
                $("#tabs").tabs("select", text);
            } else {
                var content = "<iframe frameborder=0 scrolling='yes' style='width:100%;height:100%;' src='" + url + "'></iframe>";
                $("#tabs").tabs("add", {
                    title: text,
                    iconCls: iconCls,
                    closable: true,
                    content: content
                })
            }
        }
        function loginOut() {
            $.messager.confirm('提示', '确定要退出登录吗？', function (r) {
                if (r) {
                    window.location.href = "/v1/apis/logout";
                }
            });
        }
    </script>

</head>
<body class="easyui-layout">
<div class="top" region="north">
    <span class="title">小二菜单后台管理系统</span><span class="out">欢迎&nbsp;&nbsp;<a id="name" href='javascript:void(0)'
                                                                            onclick='about()'></a>

    <a onclick="loginOut()" href="javascript:void(0)">退出</a></span></div>
<div region="center" style="overflow: hidden" id="center">
    <div class="easyui-tabs" fit="true" id="tabs">
        <div title="首页" data-options="iconCls:'icon-home'" id="main"
             style="height: 100%; position:relative;display: block">
            <div>
                <img src="/static/img/main-bg.jpg" style="width:100%;height:100%;">
            </div>
            <div style="font-size:80px;color: wheat">
                让生活更简单
            </div>
        </div>
    </div>
</div>
<div region="west" style="width:200px; overflow-y:auto; overflow-x:auto;;height: 500px" title="导航菜单" split="true">
    <div id="menu" class="easyui-accordion" data-options="fit:false,border:false">

        <!--<div style="padding:10px;" title="会员管理" data-options="iconCls:'icon-wrench'">-->
        <!--<a href="javascript:openTab('会员管理','/pages/user/manager','icon-user_home')" class="easyui-linkbutton"-->
        <!--data-options="plain:true,iconCls:'icon-user_home'">会员管理</a><br/>-->
        <!--</div>-->

        <div title="店铺管理" data-options="iconCls:'icon-wrench'" style="padding:10px">
            <a href="javascript:openTab('店铺信息管理','/v1/pages/test/shop/manager','icon-user_home')" class="easyui-linkbutton"
               data-options="plain:true,iconCls:'icon-user_home'">店铺信息管理</a><br/>
            <a href="javascript:openTab('商品管理','/v1/pages/test/goods/manager','icon-user_home')" class="easyui-linkbutton"
               data-options="plain:true,iconCls:'icon-user_home'">商品管理</a><br/>
        </div>


    </div>
</div>
</body>
</html>